{extend name='admin@main'}

{block name="content"}

{include file='hatchback/form_style'}

<form onsubmit="return false;" id="GoodsForm" data-auto="true" method="post" class='layui-form layui-card res_field_form' lay-filter="form_sub" autocomplete="off">

    <div class="layui-card-body think-box-shadow padding-left-40">

        <div class="layui-form-item layui-row layui-col-space15">
                <span class="color-green label-required-prev">车型名称</span>
                <input name="name" required class="layui-input" placeholder="请输入车型名称" value="{$vo.name|default=''}">
        </div>

        <div class="layui-form-item layui-row layui-col-space15">
            <span class="color-green label-required-prev">车型代码</span>
            <input name="code" required class="layui-input" placeholder="请输入车型代码" value="{$vo.code|default=''}">
        </div>

        <div class="layui-form-item text-center">
            <input type="hidden" name="isAddMode" value="{$isAddMode}">
            {notempty name='vo.id'}<input type="hidden" name="id" value="{$vo.id}">{/notempty}
            <button class="layui-btn layui-btn-danger" ng-click="hsitoryBack()" type="button">取消</button>
            <button class="layui-btn" type="submit">保存</button>
        </div>

    </div>
</form>
{/block}

{block name='script'}
<textarea class="layui-hide" id="goods-specs">{$vo.specs|raw|default=''}</textarea>
<textarea class="layui-hide" id="goods-value">{$defaultValues|raw|default=''}</textarea>
<script>
    window.form.render();
    require(['ckeditor', 'angular'], function () {
        var app = angular.module("GoodsForm", []).run(callback);
        angular.bootstrap(document.getElementById(app.name), [app.name]);

        function callback($rootScope) {
            $rootScope.isAddMode = parseInt('{$isAddMode|default=0}');
            // 返回项目列表
            $rootScope.hsitoryBack = function () {
                $.msg.confirm('确定要取消编辑吗？', function (index) {
                    history.back(), $.msg.close(index);
                });
            };

        }
    })
</script>

{/block}